package com.wjx.util;


import org.redisson.Redisson;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;

/**
 * Created by dingguo on 2020/5/15 下午3:12
 * Redisson单机版加锁解锁
 */
public class RedissionUtil {

    public static void main(String[] args) {
        Config config = new Config();

        config.useSingleServer().setAddress("redis://118.190.55.83:6379");

        RedissonClient client = Redisson.create(config);

        RLock lock = client.getLock("lock1");

        try {
            lock.lock();
        } finally {
           lock.unlock();
        }
    }
}
